import { AIPropertyDescriptor, IField } from "../AIProperty";
import { Field } from "./Field";

export class NumberField extends Field implements IField {
    create(o: AIPropertyDescriptor, data: any) {
        let p = this._create(o, "Number", data, 0);
        let val = this._panel.getChild("value");
        val.on("submit", this._changeHandle, this);
        return p;
    }

    protected _changeHandle(e: gui.Event) {
        let txt = (e.target as any).value;
        this.data[this.o.name] = txt;
        this._checkChange();
    }
}